<template>
	<view class="bg_color list_home">
		<Screen :shows="false" :screenData="screenData" :search="search" @changeScreenData="changeScreenData"></Screen>
		<template v-if="listData.length">
			<Scroll :isTriggered="isTriggered" :isXiaLa="total > listData.length" @refresherrefresh="refresherrefresh"
				@scrolltolower="scrolltolower">
				<Add title="新增标准地址" @add="add"></Add>
				<view class="pdd32 content">
					<view class="address_item" v-for="(item, index) in listData" :key="item.id">
						<view class="top flex_center">
							<view class="top_tittle" style="width: 516rpx" @click="() => clickItem(item.id)">{{
								item.elementName }}</view>
							<view class="list_caoZo" @click="() => operate(item)"
								v-if="store.isMe(item.userId)">
								<up-icon size="32rpx" :name="config.getImage('more')"></up-icon>
							</view>
						</view>
						<view class="" @click="() => clickItem(item.id)">
							<view class="con">
								<view class="font28 tit_con">所在地区</view>
								<view class="font28 tex">{{ item.province }}</view>
							</view>
							<view class="con">
								<view class="font28 tit_con">类行政区域</view>
								<view class="font28 tex">{{ item.administrativeRegion_dictText }}</view>
							</view>
							<view class="con">
								<view class="font28 tit_con">区划内详细地址</view>
								<view class="font28 tex dizhi">{{ item.place }}</view>
							</view>
						</view>
					</view>
				</view>
			</Scroll>
		</template>
		<NoData v-else :show="!listData.length && (screenData.status != 0 || screenData.keywords != '')">
			<view class="font28">还没有新增过标准地址!</view>
			<view class="no_btn font28" @click="add">新增标准地址</view>
		</NoData>
		<DeleteState v-if="isDelete" :success="success" @successReturn="fanhui" @failReturn="fanhui"></DeleteState>
	</view>
	<Operate :show="show" @editItem="editItem" @deleteItem="deleteItem" @close="show = false"></Operate>
	<DeleteModal :deleteShow="deleteShow" @confirm="confirm" @close="deleteShow = false"></DeleteModal>
</template>
<script>
const search = {
	text: 'keywords',
	placeholder: '请输入查询内容'
};
</script>
<script setup>
import config from '@/config.js';
import Screen from 'com/Screen.vue';
import ListITem from 'com/ListITem.vue';
import DeleteModal from 'com/modal/DeleteModal.vue';
import DeleteState from 'com/modal/DeleteState.vue';
import NoData from 'com/modal/NoData.vue';
import Operate from 'com/Operate.vue';
import Add from 'com/Add.vue';
import Scroll from 'com/Scroll.vue';
import { useState, useGetData } from 'hooks';
import { usersStore } from 'store/users.js';
const store = usersStore();
const {
	total,
	success,
	confirm,
	fanhui,
	editItem,
	isDelete,
	setTotal,
	screenData,
	scrolltolower,
	refresherrefresh,
	add,
	isTriggered,
	listData,
	changeScreenData,
	clickItem,
	operateItem,
	setOperateItem,
	operate,
	show,
	deleteItem,
	deleteShow
} = useGetData('baseAddress', 'address');
</script>

<style lang="scss" scoped>
.dizhi {
	overflow: hidden;
	-webkit-line-clamp: 2;
	text-overflow: ellipsis;
	display: -webkit-box;
	-webkit-box-orient: vertical;
}
</style>
